
module.exports = [
  {
    method: ['get', 'post'],
    path: '/api/getMessage',
    controller: function (req, res, next) {
      res.json({
        total: 0,
        message: [{
          name: 'Hello chameleon!'
        }]
      });
    }
  },
  {
    method: ['post'],
    path: '/api/v1/login',
    controller: function (req, res, next) {
      setTimeout(() => {
        var r = Math.floor(Math.random()*10);
        console.log(`mock /api/v1/login:r = ${r}`);
        if(r%2 == 0){
          res.json({
            code:'0000',
            data:{
              userName:'二狗',
              status:'1',
              age:25
            }
          });
        }else{
          res.json({
            code:'0010',
            message:'用户名密码错误',
            data:{}
          });
        }
      },2000)
      
    }
  }
]
